﻿@model IEnumerable<Db8.ViewModels.ClaimViewModel>
@{
    ViewBag.Title = "Summary";
}
<section class="content">
<div style="float:left">@Html.Partial("_Search")</div>
<div style="float:right">@Html.Partial("_Navigation")</div>
<div style="clear:both;"></div>



<br />

@Html.ActionLink("Reset Session", "Reset") | <a href="Print">Print Now</a> | <a href="Select">Select All</a>
<hr />
<section class="summary">

@foreach (var item in Model) {
    <p><strong>CLAIM: @item.Claim.Statement</strong></p>
    foreach (var cc in item.CounterClaims)
    {
    <p>
    <strong>WE SAY: @cc.Claim.Statement</strong>
    </p>
    <p>
    @Html.Raw(@cc.AbstractHtml)
    </p>
    }
    <br />
}
</section>
<hr />


</section>
@section scripts {
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/db8-ui.js")"></script>
<script type="text/javascript">

    function selectElement(element) {
        var doc = document;
        //var text = doc.getElementById(element);

        if (doc.body.createTextRange) { // ms
            var range = doc.body.createTextRange();
            range.moveToElementText(element);
            range.select();
        } else if (window.getSelection) {
            var selection = window.getSelection();
            if (selection.setBaseAndExtent) { // webkit
                selection.setBaseAndExtent(element, 0, element, 1);
            } else { // moz, opera
                var range = doc.createRange();
                range.selectNodeContents(element);
                selection.removeAllRanges();
                selection.addRange(range);
            }
        }
    }

    $("a[href='Select']").click(function (evt) {
        evt.preventDefault();
        selectElement($("section.summary")[0]);
    });

    $("a[href='Print']").click(function (evt) {
        evt.preventDefault();
        var win = window.open("");
        win.document.writeln("<html><body>");
        win.document.writeln($("section.summary").html());
        win.document.writeln("</body></html>");
        win.document.close();
        win.print()
        win.close();

    });
</script>
}
